package cn.iocoder.yudao.module.cdk.dal.mysql.cdkcdkuser;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.cdk.controller.admin.cdkcdkuser.vo.CdkCdkuserPageReqVO;
import cn.iocoder.yudao.module.cdk.dal.dataobject.cdkcdkuser.CdkCdkuserDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * cdk和用户的绑定关系 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface CdkCdkuserMapper extends BaseMapperX<CdkCdkuserDO> {

    default PageResult<CdkCdkuserDO> selectPage(CdkCdkuserPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CdkCdkuserDO>()
                .eqIfPresent(CdkCdkuserDO::getUserid, reqVO.getUserid())
                .eqIfPresent(CdkCdkuserDO::getMac, reqVO.getMac())
                .likeIfPresent(CdkCdkuserDO::getUsername, reqVO.getUsername())
                .eqIfPresent(CdkCdkuserDO::getQq, reqVO.getQq())
                .eqIfPresent(CdkCdkuserDO::getImei, reqVO.getImei())
                .eqIfPresent(CdkCdkuserDO::getIp, reqVO.getIp())
                .eqIfPresent(CdkCdkuserDO::getPhone, reqVO.getPhone())
                .eqIfPresent(CdkCdkuserDO::getCdkid, reqVO.getCdkid())
                .orderByDesc(CdkCdkuserDO::getId));
    }

}